<!-- This comment will put IE 6, 7 and 8 in quirks mode -->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<title>Código-Fonte de genetic_operator_thread.h</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javaScript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body onload='searchBox.OnSelectItem(0);'>
<!-- Gerado por Doxygen 1.6.3 -->
<script type="text/javascript"><!--
var searchBox = new SearchBox("searchBox", "search",false,'Busca');
--></script>
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Página&nbsp;Principal</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Arquivos</span></a></li>
      <li>
        <div id="MSearchBox" class="MSearchBoxInactive">
        <img id="MSearchSelect" src="search/search.png"
             onmouseover="return searchBox.OnSearchSelectShow()"
             onmouseout="return searchBox.OnSearchSelectHide()"
             alt=""/>
        <input type="text" id="MSearchField" value="Busca" accesskey="S"
             onfocus="searchBox.OnSearchFieldFocus(true)" 
             onblur="searchBox.OnSearchFieldFocus(false)" 
             onkeyup="searchBox.OnSearchFieldChange(event)"/>
        <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
        </div>
      </li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>Lista&nbsp;de&nbsp;Arquivos</span></a></li>
      <li><a href="globals.html"><span>Arquivos&nbsp;Membros</span></a></li>
    </ul>
  </div>
<h1>genetic_operator_thread.h</h1><a href="genetic__operator__thread_8h.html">Vá para a documentação deste arquivo.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 
<a name="l00008"></a>00008 <span class="preprocessor">#ifndef GENETIC_OPERATOR_THREAD_H</span>
<a name="l00009"></a>00009 <span class="preprocessor"></span><span class="preprocessor">#define GENETIC_OPERATOR_THREAD_H</span>
<a name="l00010"></a>00010 <span class="preprocessor"></span>
<a name="l00011"></a>00011 <span class="preprocessor">#include &quot;<a class="code" href="population_8h.html">population.h</a>&quot;</span>
<a name="l00012"></a>00012 <span class="preprocessor">#include &quot;<a class="code" href="definitions_8h.html">definitions.h</a>&quot;</span>
<a name="l00013"></a>00013 <span class="preprocessor">#include &quot;<a class="code" href="semaphore_8h.html">semaphore.h</a>&quot;</span>
<a name="l00014"></a>00014 <span class="comment">//#include &quot;ga_exception.h&quot;</span>
<a name="l00015"></a>00015 <span class="preprocessor">#include &lt;boost/thread/thread.hpp&gt;</span>
<a name="l00016"></a>00016 <span class="preprocessor">#include &lt;boost/thread/mutex.hpp&gt;</span>
<a name="l00017"></a>00017 <span class="preprocessor">#include &lt;boost/interprocess/sync/interprocess_semaphore.hpp&gt;</span>
<a name="l00018"></a>00018 <span class="preprocessor">#include &lt;boost/thread/condition.hpp&gt;</span>
<a name="l00019"></a>00019 <span class="preprocessor">#include &lt;typeinfo&gt;</span>
<a name="l00020"></a>00020 
<a name="l00021"></a>00021 <span class="comment">/* ----------------------------------------*/</span>
<a name="l00028"></a>00028 <span class="comment">/* ----------------------------------------*/</span>
<a name="l00029"></a>00029 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty = GAtype,<span class="keyword">typename</span> _realTy = GAreal_type&gt; <span class="keyword">class </span><a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread</a>;
<a name="l00030"></a>00030 
<a name="l00031"></a>00031 <span class="comment">/* ----------------------------------------*/</span>
<a name="l00038"></a>00038 <span class="comment">/* ----------------------------------------*/</span>
<a name="l00039"></a>00039 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt; 
<a name="l00040"></a><a class="code" href="classgenetic__operator__thread.html">00040</a> <span class="keyword">class </span><a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread</a>
<a name="l00041"></a>00041 {
<a name="l00042"></a>00042   <span class="keyword">public</span>:
<a name="l00043"></a>00043 
<a name="l00044"></a>00044     <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00045"></a>00045 <span class="comment">     * --- Definições básicas da classe                                *</span>
<a name="l00046"></a>00046 <span class="comment">     * --------------------------------------------------------------- */</span>
<a name="l00047"></a>00047 
<a name="l00048"></a>00048     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00052"></a>00052     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00053"></a><a class="code" href="classgenetic__operator__thread.html#abe926f8fc2a1548516dad216a1acd4fb">00053</a>     <span class="keyword">typedef</span> boost::mutex::scoped_lock <a class="code" href="classgenetic__operator__thread.html#abe926f8fc2a1548516dad216a1acd4fb">scoped_lock</a>;<span class="comment">//padrão scoped_lock</span>
<a name="l00054"></a>00054 
<a name="l00055"></a>00055     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00059"></a>00059     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00060"></a><a class="code" href="classgenetic__operator__thread.html#ac5a153e12dd6711746126c48edba271a">00060</a>     <span class="keyword">typedef</span> std::vector&lt;boost::thread*&gt;::iterator <a class="code" href="classgenetic__operator__thread.html#ac5a153e12dd6711746126c48edba271a">it_</a>;<span class="comment">//definição do iterator</span>
<a name="l00061"></a>00061 
<a name="l00062"></a>00062     <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00063"></a>00063 <span class="comment">     * --- Destrotor e Construtor                                      *</span>
<a name="l00064"></a>00064 <span class="comment">     * --------------------------------------------------------------- */</span>
<a name="l00065"></a>00065 
<a name="l00066"></a>00066     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00072"></a>00072     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00073"></a>00073     <a class="code" href="classgenetic__operator__thread.html#a2b60b46c5d55135436590f6aa2b11da3">genetic_operator_thread</a>(<a class="code" href="classpopulation.html">population&lt;&gt;</a>* popPt);
<a name="l00074"></a>00074     
<a name="l00075"></a>00075     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00079"></a>00079     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00080"></a>00080     <a class="code" href="classgenetic__operator__thread.html#a30c4b7a10dae2ff72905416953a64049">~genetic_operator_thread</a>();
<a name="l00081"></a>00081 
<a name="l00082"></a>00082     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00088"></a>00088     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00089"></a>00089     <a class="code" href="classgenetic__operator__thread.html#a2b60b46c5d55135436590f6aa2b11da3">genetic_operator_thread</a>(<span class="keyword">const</span> <a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread&lt;_ty,_realTy&gt;</a>&amp; got);
<a name="l00090"></a>00090 
<a name="l00091"></a>00091     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00097"></a>00097     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00098"></a><a class="code" href="classgenetic__operator__thread.html#a751c7f678d7486bee8b1a02bb9e60416">00098</a>     <a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread</a>* <a class="code" href="classgenetic__operator__thread.html#a751c7f678d7486bee8b1a02bb9e60416">GetReference</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> <span class="keyword">this</span>;}
<a name="l00099"></a>00099 
<a name="l00100"></a>00100     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00106"></a>00106     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00107"></a><a class="code" href="classgenetic__operator__thread.html#a435435aa8c4e9f50b041b40c7f63b599">00107</a>     <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a435435aa8c4e9f50b041b40c7f63b599">SetProducer</a> (<a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread&lt;_ty,_realTy&gt;</a>* new_prod_pt) {<a class="code" href="classgenetic__operator__thread.html#af325a8a1c9964fc0eac9e2eeda670499">_producerPt</a> = new_prod_pt;}
<a name="l00108"></a>00108 
<a name="l00109"></a>00109     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00115"></a>00115     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00116"></a><a class="code" href="classgenetic__operator__thread.html#a2944e0158bc914db042fdcf22a4a4e70">00116</a>     <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a2944e0158bc914db042fdcf22a4a4e70">SetConsumer</a> (<a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread</a> *cons_pt) {<a class="code" href="classgenetic__operator__thread.html#ad88e4f6c5afb05bbc55d5f44bce88ba2">_consumidorPt</a> = cons_pt;}
<a name="l00117"></a>00117 
<a name="l00118"></a>00118     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00124"></a>00124     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00125"></a><a class="code" href="classgenetic__operator__thread.html#aa9a6e0370bfd3afe316af822832a8013">00125</a>     <a class="code" href="classsemaphore.html">semaphore</a>* <a class="code" href="classgenetic__operator__thread.html#aa9a6e0370bfd3afe316af822832a8013">GetSemProducer</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _semProducer;}
<a name="l00126"></a>00126 
<a name="l00127"></a>00127     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00133"></a>00133     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00134"></a><a class="code" href="classgenetic__operator__thread.html#a73424d811348f5a911da3744dfc08762">00134</a>     <a class="code" href="classsemaphore.html">semaphore</a>* <a class="code" href="classgenetic__operator__thread.html#a73424d811348f5a911da3744dfc08762">GetSemConsumer</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _semConsumer;}
<a name="l00135"></a>00135 
<a name="l00136"></a>00136     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00140"></a>00140     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00141"></a>00141     <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#abd1a0cb47d379e74f3e738f5c75fe7b7">ApplyGeneticOperator</a> (<span class="keywordtype">void</span>);
<a name="l00142"></a>00142 
<a name="l00143"></a>00143     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00149"></a>00149     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00150"></a>00150     <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a5e739f35ac03b42311540dbf4db25d2e">AddIndividual</a> (<a class="code" href="classindividual.html">individual&lt;_ty,_realTy&gt;</a>* newId);
<a name="l00151"></a>00151 
<a name="l00152"></a>00152     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00158"></a>00158     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00159"></a>00159     <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a1e355fe496238b6433bbf9f3f70bf6ad">PushBackIndividual</a> (<a class="code" href="classindividual.html">individual&lt;_ty,_realTy&gt;</a>* newId);
<a name="l00160"></a>00160 
<a name="l00161"></a>00161     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00167"></a>00167     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00168"></a><a class="code" href="classgenetic__operator__thread.html#aba37d3926c0ae0f61846a3e98cfeaf39">00168</a>     <a class="code" href="classindividual.html">individual&lt;_ty,_realTy&gt;</a>* <a class="code" href="classgenetic__operator__thread.html#aba37d3926c0ae0f61846a3e98cfeaf39">GetBestIndividual</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;GetBestId();}
<a name="l00169"></a>00169 
<a name="l00170"></a>00170     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00174"></a>00174     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00175"></a><a class="code" href="classgenetic__operator__thread.html#a44556f084005e19742891fae2e3c8df3">00175</a>     <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a44556f084005e19742891fae2e3c8df3">UpdatePopulation</a> (<span class="keywordtype">void</span>) {this-&gt;<a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;UpdateData();}
<a name="l00176"></a>00176 
<a name="l00177"></a>00177     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00181"></a>00181     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00182"></a>00182     <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#afaab02a61f5f0a52b37c4f8bda8df131">PrintPopulation</a> (<span class="keywordtype">void</span>);
<a name="l00183"></a>00183 
<a name="l00184"></a>00184     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00190"></a>00190     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00191"></a><a class="code" href="classgenetic__operator__thread.html#adbc04b2ec67ef127c316efd2bfb407c4">00191</a>     boost::condition&amp; <a class="code" href="classgenetic__operator__thread.html#adbc04b2ec67ef127c316efd2bfb407c4">GetCondApplyOp</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _condApplyOperator;}
<a name="l00192"></a>00192 
<a name="l00193"></a>00193     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00199"></a>00199     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00200"></a><a class="code" href="classgenetic__operator__thread.html#a0973b32bc54f444ca7afcdcdfef9a38a">00200</a>     boost::mutex <a class="code" href="classgenetic__operator__thread.html#a0973b32bc54f444ca7afcdcdfef9a38a">GetMutexCondApplyOp</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _mutexCondApplyOp;}
<a name="l00201"></a>00201 
<a name="l00202"></a>00202     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00208"></a>00208     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00209"></a><a class="code" href="classgenetic__operator__thread.html#a2fdf96fda297cef206de86300ab7df0c">00209</a>     <span class="keywordtype">bool</span> <a class="code" href="classgenetic__operator__thread.html#a2fdf96fda297cef206de86300ab7df0c">FullPopulation</a> (<span class="keywordtype">void</span>)<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;GetNumerOfIndividuals() == def::population::population_size;}
<a name="l00210"></a>00210 
<a name="l00211"></a>00211     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00217"></a>00217     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00218"></a><a class="code" href="classgenetic__operator__thread.html#a3f9defee5440ebe6d973bcc8806d64ee">00218</a>     <a class="code" href="classgenetic__operator__thread.html#ac5a153e12dd6711746126c48edba271a">it_</a> <a class="code" href="classgenetic__operator__thread.html#a3f9defee5440ebe6d973bcc8806d64ee">Begin</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _threadVec.begin();}
<a name="l00219"></a>00219 
<a name="l00220"></a>00220     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00226"></a>00226     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00227"></a><a class="code" href="classgenetic__operator__thread.html#ae836d401cde0a8ac21025348b9fcedf6">00227</a>     <a class="code" href="classgenetic__operator__thread.html#ac5a153e12dd6711746126c48edba271a">it_</a> <a class="code" href="classgenetic__operator__thread.html#ae836d401cde0a8ac21025348b9fcedf6">End</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _threadVec.end();}
<a name="l00228"></a>00228 
<a name="l00229"></a>00229     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00233"></a>00233     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00234"></a><a class="code" href="classgenetic__operator__thread.html#a7c86cee81334320d496fb196920fcc10">00234</a>     <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a7c86cee81334320d496fb196920fcc10">ReadyToReceive</a> (<span class="keywordtype">void</span>){}
<a name="l00235"></a>00235 
<a name="l00236"></a>00236   <span class="keyword">protected</span>:
<a name="l00237"></a>00237 
<a name="l00238"></a>00238 
<a name="l00239"></a>00239     <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00240"></a>00240 <span class="comment">     * --- Atributos protected                                         *</span>
<a name="l00241"></a>00241 <span class="comment">     * --------------------------------------------------------------- */</span>
<a name="l00242"></a>00242     
<a name="l00243"></a>00243     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00247"></a>00247     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00248"></a><a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">00248</a>     <a class="code" href="classpopulation.html">population&lt;_ty,_realTy&gt;</a>* <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>;
<a name="l00249"></a>00249 
<a name="l00250"></a>00250     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00254"></a>00254     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00255"></a><a class="code" href="classgenetic__operator__thread.html#ad88e4f6c5afb05bbc55d5f44bce88ba2">00255</a>     <a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread&lt;_ty,_realTy&gt;</a>* <a class="code" href="classgenetic__operator__thread.html#ad88e4f6c5afb05bbc55d5f44bce88ba2">_consumidorPt</a>;
<a name="l00256"></a>00256 
<a name="l00257"></a>00257     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00261"></a>00261     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00262"></a><a class="code" href="classgenetic__operator__thread.html#af325a8a1c9964fc0eac9e2eeda670499">00262</a>     <a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread&lt;_ty,_realTy&gt;</a>* <a class="code" href="classgenetic__operator__thread.html#af325a8a1c9964fc0eac9e2eeda670499">_producerPt</a>;
<a name="l00263"></a>00263 
<a name="l00264"></a>00264     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00268"></a>00268     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00269"></a><a class="code" href="classgenetic__operator__thread.html#a886d986c24ceb36bff5a77bf58447be0">00269</a>     <span class="keywordtype">int</span> <a class="code" href="classgenetic__operator__thread.html#a886d986c24ceb36bff5a77bf58447be0">_coreNumbers</a>;
<a name="l00270"></a>00270 
<a name="l00271"></a>00271     <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00272"></a>00272 <span class="comment">     * --- início dos atributos de sincronização                       *</span>
<a name="l00273"></a>00273 <span class="comment">     * --------------------------------------------------------------- */</span>
<a name="l00274"></a>00274 
<a name="l00275"></a>00275     <span class="comment">//iterator e mutex do produtor do vetor de populações</span>
<a name="l00276"></a>00276     <span class="keyword">typename</span> <a class="code" href="classpopulation.html">population&lt;_ty,_realTy&gt;::it_</a> _inIterator;
<a name="l00277"></a>00277     boost::mutex _inMutex;
<a name="l00278"></a>00278     boost::mutex GetInMutex (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _inMutex;}
<a name="l00279"></a>00279     
<a name="l00280"></a>00280     <span class="comment">//iterator e mutex do consumidor do vetor de populações</span>
<a name="l00281"></a>00281     <span class="keyword">typename</span> <a class="code" href="classpopulation.html">population&lt;_ty,_realTy&gt;::it_</a> _outIterator;
<a name="l00282"></a>00282     boost::mutex _outMutex;
<a name="l00283"></a>00283     boost::mutex GetOutMutex (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> _outMutex;}
<a name="l00284"></a>00284 
<a name="l00285"></a>00285     <span class="comment">//semáforos do consumidor e produtor</span>
<a name="l00286"></a>00286     <a class="code" href="classsemaphore.html">semaphore</a> *_semConsumer,*_semProducer;
<a name="l00287"></a>00287 
<a name="l00288"></a>00288     <span class="comment">//variável de condição para aplicar o operador, e o respectivo mutex associado</span>
<a name="l00289"></a>00289     boost::condition _condApplyOperator;
<a name="l00290"></a>00290     boost::mutex _mutexCondApplyOp;
<a name="l00291"></a>00291     
<a name="l00292"></a>00292 
<a name="l00293"></a>00293 
<a name="l00294"></a>00294     <span class="comment">//variável de condição para parar de aplicar o operador(condição de parada do ga), e o respectivo mutex associado</span>
<a name="l00295"></a>00295     boost::condition _condStopCondition;
<a name="l00296"></a>00296     boost::mutex _mutexCondStopCond;
<a name="l00297"></a>00297 
<a name="l00298"></a>00298     <span class="comment">//vetor de threads</span>
<a name="l00299"></a>00299     <span class="comment">//boost::thread _threadVec[];</span>
<a name="l00300"></a>00300     std::vector&lt;boost::thread*&gt; _threadVec;
<a name="l00301"></a>00301     
<a name="l00302"></a>00302     <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00303"></a>00303 <span class="comment">     * --- Região de métodos/atributos estáticos                       *</span>
<a name="l00304"></a>00304 <span class="comment">     * --------------------------------------------------------------- */</span>
<a name="l00305"></a>00305 
<a name="l00306"></a>00306     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00310"></a>00310     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00311"></a><a class="code" href="classgenetic__operator__thread.html#acdf9606e26ae1240cd1c9fced36c656a">00311</a>     <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classgenetic__operator__thread.html#acdf9606e26ae1240cd1c9fced36c656a">_genCount</a>;
<a name="l00312"></a>00312     
<a name="l00313"></a>00313     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00317"></a>00317     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00318"></a><a class="code" href="classgenetic__operator__thread.html#afb4be1bcb256082a4d6e90faba3e5567">00318</a>     <span class="keyword">static</span> boost::mutex <a class="code" href="classgenetic__operator__thread.html#afb4be1bcb256082a4d6e90faba3e5567">_MutexgenCount</a>;
<a name="l00319"></a>00319 
<a name="l00320"></a>00320     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00326"></a>00326     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00327"></a>00327     <span class="keyword">static</span> <span class="keywordtype">int</span>&amp; <a class="code" href="classgenetic__operator__thread.html#a22db2979e50888a982e4d78a874b0193">GetGenerationCount</a> (<span class="keywordtype">void</span>); 
<a name="l00328"></a>00328 
<a name="l00329"></a>00329     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00333"></a>00333     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00334"></a>00334     <span class="keyword">static</span> <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a77fb097a6fa283eebe5cf6af08dd2cfc">IncrementGenerationCount</a> (<span class="keywordtype">void</span>);
<a name="l00335"></a>00335 
<a name="l00336"></a>00336     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00342"></a>00342     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00343"></a><a class="code" href="classgenetic__operator__thread.html#aad1cfa9857458b80ca2f5ba2fa3c5d74">00343</a>     <span class="keyword">static</span> <span class="keywordtype">bool</span> <a class="code" href="classgenetic__operator__thread.html#aad1cfa9857458b80ca2f5ba2fa3c5d74">EndOfGA</a> (<span class="keywordtype">void</span>) {<span class="keywordflow">return</span> <a class="code" href="classgenetic__operator__thread.html#acdf9606e26ae1240cd1c9fced36c656a">_genCount</a> &gt;= def::genetic_operator::numberOfGenerations;}
<a name="l00344"></a>00344 
<a name="l00345"></a>00345     <span class="comment">/* --------------------------------------------------------------- *</span>
<a name="l00346"></a>00346 <span class="comment">     * --- fim dos atributos de sincronização                          *</span>
<a name="l00347"></a>00347 <span class="comment">     * --------------------------------------------------------------- */</span>
<a name="l00348"></a>00348 
<a name="l00349"></a>00349     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00355"></a>00355     <span class="comment">/* ----------------------------------------*/</span>
<a name="l00356"></a>00356     <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a856af75479279710968a1aa2b26400de">IncrementIterator</a> (<span class="keyword">typename</span> <a class="code" href="classpopulation.html">population&lt;_ty,_realTy&gt;::it_</a>&amp; it);
<a name="l00357"></a>00357 
<a name="l00358"></a>00358 };
<a name="l00359"></a>00359 
<a name="l00360"></a>00360 
<a name="l00361"></a>00361 <span class="comment">//inicia o contador das gerações, que é uma variável estática</span>
<a name="l00362"></a>00362 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00363"></a>00363 <span class="keywordtype">int</span> <a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread&lt;_ty,_realTy&gt;::_genCount</a> = 0;
<a name="l00364"></a>00364 
<a name="l00365"></a>00365 <span class="comment">//inicia o mutex que é uma variável estática</span>
<a name="l00366"></a>00366 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00367"></a>00367 boost::mutex <a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread&lt;_ty,_realTy&gt;::_MutexgenCount</a>;
<a name="l00368"></a>00368 
<a name="l00369"></a>00369 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00370"></a><a class="code" href="classgenetic__operator__thread.html#adb72da6103f5995bd4c265789e5eceac">00370</a> <a class="code" href="classgenetic__operator__thread.html#a2b60b46c5d55135436590f6aa2b11da3">genetic_operator_thread&lt;_ty,_realTy&gt;::genetic_operator_thread</a> (<span class="keyword">const</span> <a class="code" href="classgenetic__operator__thread.html">genetic_operator_thread&lt;_ty,_realTy&gt;</a>&amp; got)
<a name="l00371"></a>00371 {
<a name="l00372"></a>00372   this-&gt;_semProducer = got._semProducer;
<a name="l00373"></a>00373   this-&gt;_semConsumer = got.semProduce;
<a name="l00374"></a>00374   this-&gt;<a class="code" href="classgenetic__operator__thread.html#ad88e4f6c5afb05bbc55d5f44bce88ba2">_consumidorPt</a> = got.<a class="code" href="classgenetic__operator__thread.html#ad88e4f6c5afb05bbc55d5f44bce88ba2">_consumidorPt</a>;
<a name="l00375"></a>00375   this-&gt;<a class="code" href="classgenetic__operator__thread.html#af325a8a1c9964fc0eac9e2eeda670499">_producerPt</a> = got.<a class="code" href="classgenetic__operator__thread.html#af325a8a1c9964fc0eac9e2eeda670499">_producerPt</a>;
<a name="l00376"></a>00376 
<a name="l00377"></a>00377   <span class="comment">//begin debug</span>
<a name="l00378"></a>00378   std::cout &lt;&lt; <span class="stringliteral">&quot;Entrou no construtor de cópia&quot;</span> &lt;&lt; std::endl;
<a name="l00379"></a>00379  <span class="comment">//end debug </span>
<a name="l00380"></a>00380 
<a name="l00381"></a>00381 }
<a name="l00382"></a>00382 
<a name="l00383"></a>00383 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00384"></a><a class="code" href="classgenetic__operator__thread.html#abd1a0cb47d379e74f3e738f5c75fe7b7">00384</a> <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#abd1a0cb47d379e74f3e738f5c75fe7b7">genetic_operator_thread&lt;_ty,_realTy&gt;::ApplyGeneticOperator</a> (<span class="keywordtype">void</span>)
<a name="l00385"></a>00385 {
<a name="l00386"></a>00386 
<a name="l00387"></a>00387   <span class="comment">/********************************** início da seção crítica *************************************/</span>
<a name="l00388"></a>00388   <span class="keywordflow">try</span>
<a name="l00389"></a>00389   {
<a name="l00390"></a>00390     <a class="code" href="classgenetic__operator__thread.html#abe926f8fc2a1548516dad216a1acd4fb">scoped_lock</a> lock(_mutexCondApplyOp);
<a name="l00391"></a>00391     _condApplyOperator.notify_all(); <span class="comment">//dispara todas as threads que esperam pelo mutex</span>
<a name="l00392"></a>00392   }
<a name="l00393"></a>00393   <span class="keywordflow">catch</span>(std::exception ex)
<a name="l00394"></a>00394   {
<a name="l00395"></a>00395     std::cout &lt;&lt; <span class="stringliteral">&quot;Excessao no ga. ApplyGeneticOperator: &quot;</span> &lt;&lt; ex.what() &lt;&lt; std::endl;
<a name="l00396"></a>00396   }
<a name="l00397"></a>00397 
<a name="l00398"></a>00398   <span class="comment">/********************************** fim da seção crítica ****************************************/</span>
<a name="l00399"></a>00399 }
<a name="l00400"></a>00400 
<a name="l00401"></a>00401 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt; 
<a name="l00402"></a><a class="code" href="classgenetic__operator__thread.html#a2b60b46c5d55135436590f6aa2b11da3">00402</a> <a class="code" href="classgenetic__operator__thread.html#a2b60b46c5d55135436590f6aa2b11da3">genetic_operator_thread&lt;_ty,_realTy&gt;::genetic_operator_thread</a> (<a class="code" href="classpopulation.html">population&lt;&gt;</a>* popPt)
<a name="l00403"></a>00403 :_coreNumbers(sysconf( _SC_NPROCESSORS_ONLN ))<span class="comment">//inicia o numero de núcleos do processador</span>
<a name="l00404"></a>00404 {
<a name="l00405"></a>00405   <span class="comment">//variável para testar se a inicialização dos objetos de sincronização foi feita corretamente</span>
<a name="l00406"></a>00406   <span class="keywordtype">int</span> status;
<a name="l00407"></a>00407 
<a name="l00408"></a>00408   <span class="comment">//se não foi passada uma população, cria uma</span>
<a name="l00409"></a>00409   <span class="keywordflow">if</span> (popPt == NULL)
<a name="l00410"></a>00410   {
<a name="l00411"></a>00411     <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a> = <span class="keyword">new</span> <a class="code" href="classpopulation.html">population&lt;_ty,_realTy&gt;</a>();
<a name="l00412"></a>00412   }
<a name="l00413"></a>00413   <span class="keywordflow">else</span>
<a name="l00414"></a>00414     <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a> = popPt;
<a name="l00415"></a>00415 
<a name="l00416"></a>00416   <span class="comment">//gera a população aleatória</span>
<a name="l00417"></a>00417   <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;GeneratePopulation();
<a name="l00418"></a>00418 
<a name="l00419"></a>00419   <span class="comment">//atualiza o fitness de todos os individuos da população</span>
<a name="l00420"></a>00420   <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;SetIndividualsValue();
<a name="l00421"></a>00421 
<a name="l00422"></a>00422   <span class="comment">//seta os iterators dos consumidores e produtores bem como os mutexes de cada um</span>
<a name="l00423"></a>00423   _inIterator = _outIterator = <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;begin();
<a name="l00424"></a>00424 
<a name="l00425"></a>00425 }
<a name="l00426"></a>00426 
<a name="l00427"></a>00427 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00428"></a><a class="code" href="classgenetic__operator__thread.html#a5e739f35ac03b42311540dbf4db25d2e">00428</a> <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a5e739f35ac03b42311540dbf4db25d2e">genetic_operator_thread&lt;_ty,_realTy&gt;::AddIndividual</a> (<a class="code" href="classindividual.html">individual&lt;_ty,_realTy&gt;</a>* newId)
<a name="l00429"></a>00429 {
<a name="l00430"></a>00430 
<a name="l00431"></a>00431   <span class="keywordflow">try</span>
<a name="l00432"></a>00432   {
<a name="l00433"></a>00433     <a class="code" href="classgenetic__operator__thread.html#af325a8a1c9964fc0eac9e2eeda670499">_producerPt</a>-&gt;GetSemProducer()-&gt;wait();
<a name="l00434"></a>00434   }
<a name="l00435"></a>00435   <span class="keywordflow">catch</span> (std::exception&amp; ex)
<a name="l00436"></a>00436   {
<a name="l00437"></a>00437     std::cout &lt;&lt; <span class="stringliteral">&quot;Erro ao esperar por semáforo produtor. Método: AddIndividual&quot;</span> &lt;&lt; ex.what() &lt;&lt; std::endl;
<a name="l00438"></a>00438   }
<a name="l00439"></a>00439  
<a name="l00440"></a>00440   <span class="keywordflow">try</span>
<a name="l00441"></a>00441   {
<a name="l00442"></a>00442     <a class="code" href="classgenetic__operator__thread.html#abe926f8fc2a1548516dad216a1acd4fb">scoped_lock</a> lock(_inMutex);
<a name="l00443"></a>00443 
<a name="l00444"></a>00444     *_inIterator = newId; <span class="comment">//depositda o indivíduo</span>
<a name="l00445"></a>00445     <a class="code" href="classgenetic__operator__thread.html#a856af75479279710968a1aa2b26400de">IncrementIterator</a>(_inIterator);<span class="comment">//e atualiza o iterator</span>
<a name="l00446"></a>00446 
<a name="l00447"></a>00447   }
<a name="l00448"></a>00448   <span class="keywordflow">catch</span> (std::exception&amp; ex)
<a name="l00449"></a>00449   {
<a name="l00450"></a>00450 
<a name="l00451"></a>00451     std::cout &lt;&lt; <span class="stringliteral">&quot;Erro&quot;</span> &lt;&lt; ex.what() &lt;&lt; std::endl;
<a name="l00452"></a>00452   }
<a name="l00453"></a>00453    
<a name="l00454"></a>00454   <span class="keywordflow">try</span>
<a name="l00455"></a>00455   {
<a name="l00456"></a>00456     _semConsumer-&gt;<a class="code" href="classsemaphore.html#a14c3b9f4312c43d9400905c938752665">post</a>();
<a name="l00457"></a>00457   }
<a name="l00458"></a>00458   <span class="keywordflow">catch</span> (std::exception&amp; ex)
<a name="l00459"></a>00459   {
<a name="l00460"></a>00460     std::cout &lt;&lt; <span class="stringliteral">&quot;Erro&quot;</span> &lt;&lt; ex.what() &lt;&lt; std::endl;
<a name="l00461"></a>00461   }
<a name="l00462"></a>00462  
<a name="l00463"></a>00463 }
<a name="l00464"></a>00464 
<a name="l00465"></a>00465 <span class="comment">//deve ser usado apenas na seção crítica do iterator it</span>
<a name="l00466"></a>00466 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00467"></a><a class="code" href="classgenetic__operator__thread.html#a856af75479279710968a1aa2b26400de">00467</a> <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a856af75479279710968a1aa2b26400de">genetic_operator_thread&lt;_ty,_realTy&gt;::IncrementIterator</a> (<span class="keyword">typename</span> <a class="code" href="classpopulation.html">population&lt;_ty,_realTy&gt;::it_</a>&amp; it)
<a name="l00468"></a>00468 {
<a name="l00469"></a>00469   <span class="keywordflow">if</span> (it+1 != <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;end())
<a name="l00470"></a>00470     ++it;
<a name="l00471"></a>00471   <span class="keywordflow">else</span>
<a name="l00472"></a>00472     it = <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;begin();
<a name="l00473"></a>00473 }
<a name="l00474"></a>00474 
<a name="l00475"></a>00475 <span class="keyword">template</span>&lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt; 
<a name="l00476"></a><a class="code" href="classgenetic__operator__thread.html#a30c4b7a10dae2ff72905416953a64049">00476</a> <a class="code" href="classgenetic__operator__thread.html#a30c4b7a10dae2ff72905416953a64049">genetic_operator_thread&lt;_ty,_realTy&gt;::~genetic_operator_thread</a>(<span class="keywordtype">void</span>)
<a name="l00477"></a>00477 {
<a name="l00478"></a>00478   <span class="keywordflow">for</span> ( <a class="code" href="classpopulation.html">population&lt;&gt;::it_</a> it = <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;begin(); it != <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;end(); ++it)
<a name="l00479"></a>00479     <span class="keyword">delete</span> *it;
<a name="l00480"></a>00480 }
<a name="l00481"></a>00481 
<a name="l00482"></a>00482 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00483"></a><a class="code" href="classgenetic__operator__thread.html#a1e355fe496238b6433bbf9f3f70bf6ad">00483</a> <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a1e355fe496238b6433bbf9f3f70bf6ad">genetic_operator_thread&lt;_ty,_realTy&gt;::PushBackIndividual</a> (<a class="code" href="classindividual.html">individual&lt;_ty,_realTy&gt;</a>* newId)
<a name="l00484"></a>00484 {
<a name="l00485"></a>00485 
<a name="l00486"></a>00486   <span class="keywordflow">try</span>
<a name="l00487"></a>00487   {
<a name="l00488"></a>00488     <a class="code" href="classgenetic__operator__thread.html#af325a8a1c9964fc0eac9e2eeda670499">_producerPt</a>-&gt;GetSemProducer()-&gt;wait();
<a name="l00489"></a>00489   }
<a name="l00490"></a>00490   <span class="keywordflow">catch</span> (std::exception&amp; ex)
<a name="l00491"></a>00491   {
<a name="l00492"></a>00492     std::cout &lt;&lt; <span class="stringliteral">&quot;Erro ao esperar por semáforo produtor. Método: AddIndividual&quot;</span> &lt;&lt; ex.what() &lt;&lt; std::endl;
<a name="l00493"></a>00493   }
<a name="l00494"></a>00494  
<a name="l00495"></a>00495   <span class="keywordflow">try</span>
<a name="l00496"></a>00496   {
<a name="l00497"></a>00497     <a class="code" href="classgenetic__operator__thread.html#abe926f8fc2a1548516dad216a1acd4fb">scoped_lock</a> lock(_inMutex);
<a name="l00498"></a>00498     <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;AddIndividualToPopulation(newId);
<a name="l00499"></a>00499   }
<a name="l00500"></a>00500   <span class="keywordflow">catch</span> (std::exception&amp; ex)
<a name="l00501"></a>00501   {
<a name="l00502"></a>00502 
<a name="l00503"></a>00503     std::cout &lt;&lt; <span class="stringliteral">&quot;Erro&quot;</span> &lt;&lt; ex.what() &lt;&lt; std::endl;
<a name="l00504"></a>00504   }
<a name="l00505"></a>00505    
<a name="l00506"></a>00506   <span class="keywordflow">try</span>
<a name="l00507"></a>00507   {
<a name="l00508"></a>00508     _semConsumer-&gt;<a class="code" href="classsemaphore.html#a14c3b9f4312c43d9400905c938752665">post</a>();
<a name="l00509"></a>00509   }
<a name="l00510"></a>00510   <span class="keywordflow">catch</span> (std::exception&amp; ex)
<a name="l00511"></a>00511   {
<a name="l00512"></a>00512     std::cout &lt;&lt; <span class="stringliteral">&quot;Erro&quot;</span> &lt;&lt; ex.what() &lt;&lt; std::endl;
<a name="l00513"></a>00513   }
<a name="l00514"></a>00514 }
<a name="l00515"></a>00515 
<a name="l00516"></a>00516 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00517"></a><a class="code" href="classgenetic__operator__thread.html#a77fb097a6fa283eebe5cf6af08dd2cfc">00517</a> <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#a77fb097a6fa283eebe5cf6af08dd2cfc">genetic_operator_thread&lt;_ty,_realTy&gt;::IncrementGenerationCount</a> (<span class="keywordtype">void</span>)
<a name="l00518"></a>00518 {
<a name="l00519"></a>00519   <a class="code" href="classgenetic__operator__thread.html#abe926f8fc2a1548516dad216a1acd4fb">scoped_lock</a> lock(<a class="code" href="classgenetic__operator__thread.html#afb4be1bcb256082a4d6e90faba3e5567">_MutexgenCount</a>);
<a name="l00520"></a>00520   <a class="code" href="classgenetic__operator__thread.html#acdf9606e26ae1240cd1c9fced36c656a">_genCount</a>++;
<a name="l00521"></a>00521 }
<a name="l00522"></a>00522 
<a name="l00523"></a>00523 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00524"></a><a class="code" href="classgenetic__operator__thread.html#a22db2979e50888a982e4d78a874b0193">00524</a> <span class="keywordtype">int</span>&amp; <a class="code" href="classgenetic__operator__thread.html#a22db2979e50888a982e4d78a874b0193">genetic_operator_thread&lt;_ty,_realTy&gt;::GetGenerationCount</a> (<span class="keywordtype">void</span>) 
<a name="l00525"></a>00525 {
<a name="l00526"></a>00526   <a class="code" href="classgenetic__operator__thread.html#abe926f8fc2a1548516dad216a1acd4fb">scoped_lock</a> lock(<a class="code" href="classgenetic__operator__thread.html#afb4be1bcb256082a4d6e90faba3e5567">_MutexgenCount</a>);
<a name="l00527"></a>00527   <span class="keywordflow">return</span> <a class="code" href="classgenetic__operator__thread.html#acdf9606e26ae1240cd1c9fced36c656a">_genCount</a>;
<a name="l00528"></a>00528 }
<a name="l00529"></a>00529 
<a name="l00530"></a>00530 <span class="keyword">template</span> &lt;<span class="keyword">typename</span> _ty,<span class="keyword">typename</span> _realTy&gt;
<a name="l00531"></a><a class="code" href="classgenetic__operator__thread.html#afaab02a61f5f0a52b37c4f8bda8df131">00531</a> <span class="keywordtype">void</span> <a class="code" href="classgenetic__operator__thread.html#afaab02a61f5f0a52b37c4f8bda8df131">genetic_operator_thread&lt;_ty,_realTy&gt;::PrintPopulation</a> (<span class="keywordtype">void</span>)
<a name="l00532"></a>00532 {
<a name="l00533"></a>00533   <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;SortPopulation();
<a name="l00534"></a>00534   <span class="keywordflow">for</span> (<span class="keyword">typename</span> <a class="code" href="classpopulation.html">population&lt;_ty,_realTy&gt;::it_</a> it = <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;begin(); it != <a class="code" href="classgenetic__operator__thread.html#ae0bb1f4c8c30c5557eefc870d2767d66">_popOperatorPt</a>-&gt;end(); ++it)
<a name="l00535"></a>00535   {
<a name="l00536"></a>00536     std::cout &lt;&lt; (*it)-&gt;GetID() &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; (*it)-&gt;GetValue();
<a name="l00537"></a>00537     <span class="keywordflow">for</span> (<span class="keyword">typename</span> <a class="code" href="classindividual.html">individual&lt;_ty,_realTy&gt;::it_</a> it_coo = (*it)-&gt;begin(); it_coo != (*it)-&gt;end(); ++it_coo)
<a name="l00538"></a>00538       std::cout &lt;&lt; <span class="stringliteral">&quot; &quot;</span> &lt;&lt; (*it_coo)-&gt;GetValue() &lt;&lt; <span class="stringliteral">&quot;(&quot;</span> &lt;&lt; (*it_coo)-&gt;Decode() &lt;&lt; <span class="stringliteral">&quot;),&quot;</span>;
<a name="l00539"></a>00539     std::cout &lt;&lt; std::endl;
<a name="l00540"></a>00540   }
<a name="l00541"></a>00541 }
<a name="l00542"></a>00542 
<a name="l00543"></a>00543 <span class="preprocessor">#endif //GENETIC_OPERATOR_THREAD_H</span>
</pre></div></div>
<!--- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&nbsp;</span>Todos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&nbsp;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&nbsp;</span>Arquivos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&nbsp;</span>Funções</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&nbsp;</span>Variáveis</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&nbsp;</span>Definições de Tipos</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&nbsp;</span>Amigas</a></div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<hr class="footer"/><address style="text-align: right;"><small>Gerado em Sat Oct 30 13:47:50 2010 por&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.3 </small></address>
</body>
</html>
